package com.design.interpreter.command;

interface Command {
    void execute();
}

class MoveCommand implements Command {
    private String direction;

    public MoveCommand(String direction) {
        this.direction = direction;
    }

    @Override
    public void execute() {
        System.out.println("Moving in direction: " + direction);
    }
}

class AttackCommand implements Command {
    @Override
    public void execute() {
        System.out.println("Attacking enemy");
    }
}

class CommandInterpreter {
    public void interpret(Command command) {
        command.execute();
    }
}

public class InterpreterPatternDemo {
    public static void main(String[] args) {
        Command moveCommand = new MoveCommand("forward");
        Command attackCommand = new AttackCommand();

        CommandInterpreter interpreter = new CommandInterpreter();
        interpreter.interpret(moveCommand);
        interpreter.interpret(attackCommand);
    }
}
